package com.tanhua.dubbo.api;

import com.tanhua.dubbo.mappers.FreezeMapper;
import com.tanhua.model.domain.FreezeDetail;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class FreezeApiImpl implements FreezeApi {

    @Autowired
    private FreezeMapper freezeMapper;

    @Override
    public void freeze(FreezeDetail freezeDetail) {
        freezeMapper.insert(freezeDetail);
    }

    @Override
    public FreezeDetail unfreeze(Integer userId) {
        FreezeDetail freezeDetail = freezeMapper.selectById(userId);

        freezeMapper.deleteById(userId);
        return freezeDetail;
    }
}
